package com.jt.util;

import com.jt.pojo.User;

/**
 * @author 张琪
 * @date 2020/12/17
 * @describe
 */
public class UserThreadLocal {
    //    threadLocal 本质上就是一个变量, 可以用来存储任何数据
    public static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static void setUser(User user) {
        threadLocal.set(user);
    }

    public static User getUser() {
        return threadLocal.get();
    }
}
